const serverURL='http://114.55.38.80:9000/server/';
const serviceURL='http://114.55.38.80:9000/service/';
const urls = 'http://114.55.38.80:9000';
var socketList=[];
//const sokceturl = "wss://xcx.juseyx.cn";
function leftTimer(year, month, day, hour, minute, second) {
	var leftTime = (new Date(year, month - 1, day, hour, minute, second)) - (new Date()); //计算剩余的毫秒数 
	var days = parseInt(leftTime / 1000 / 60 / 60 / 24, 10); //计算剩余的天数 
	var hours = parseInt(leftTime / 1000 / 60 / 60 % 24, 10); //计算剩余的小时 
	var minutes = parseInt(leftTime / 1000 / 60 % 60, 10); //计算剩余的分钟 
	var seconds = parseInt(leftTime / 1000 % 60, 10); //计算剩余的秒数 
	days = checkTime(days);
	hours = checkTime(hours);
	minutes = checkTime(minutes);
	seconds = checkTime(seconds);
	setInterval("leftTimer(2017,12,20,17,14,11)", 1000);
	//document.getElementById("timer").innerHTML = days + "天" + hours + "小时" + minutes + "分" + seconds + "秒";
	if(minutes == 0 && seconds == 0) {
		alert('时间到')
	}
};

function checkTime(i) { //将0-9的数字前面加上0，例1变为01 
	if(i < 10) {
		i = "0" + i;
	}
	return i;
};


//采集单级别分类
var tree=[];
var oldtree=[];
function queryorder(){
	let msg = window.sessionStorage['user_msg'];
	msg = JSON.parse(msg);
	$.ajax({
		url: serverURL+"classifyTree",
		traditional: true,
		type: "get",
		dataType: "json",
		data: {},
		async: true,
		headers: {
			'Authorization': 'Bearer ' + msg.token
		},
		success: function(res) {
			console.log(res.tree.children);
			var children_s =res.tree.children;
			oldtree=children_s;
			let selecthtml='<option value="" selected="true" disabled="true">请选择科室</option>';
			$("#select_menAnd_wormen").children("option").remove();
			if(res.code==200){
				//一级列表
			     for(let a =0 ; a<children_s.length;a++){
			     	 tree.push({text:children_s[a].label,id:a,value:children_s[a].value});
			     	selecthtml+=`<option value="${children_s[a].value}" id="${a}">${children_s[a].label}</option>`;
			     };
			     $("#select_menAnd_wormen").html(selecthtml);
			    // 二级列表 获取点击对于的id   children_s[a].children
				
			};
		},
		error: function(err) {
			console.log(err)
		}
	})
};
//date输入框日期限制




